void CleanAccu (ImSize, AccuRows, AccuCols, WinSize, InAccu, OutAccu)
int  ImSize, AccuRows, AccuCols, WinSize;
BYTE ** InAccu;
BYTE ** OutAccu;
{
   BYTE Inc, Max;
   int  r,c, yw,xw, ya,xa, h;

   for (r=0; r<AccuRows; r++)
      for (c=0; c<AccuCols; c++)  OutAccu [r][c] = 0;

   h = WinSize>>1;

   for (r=0; r<AccuRows; r++) {
      for (c=0; c<AccuCols; c++) {
         Inc = InAccu[r][c];
         if (Inc) {
            Max = 0;
            for (yw=r-h; yw<=r+h; yw++) {
               for (xw=c-h; xw<=c+h; xw++) {
                  if (xw<0) {
                     xa = xw+AccuCols;
                     ya = AccuRows-yw;
                  }else if (xw>=AccuCols) {
                     xa = xw-AccuCols;
                     ya = AccuRows-yw;
                  }else{
                     xa = xw;
                     ya = yw;
                  }
                  if (InAccu[ya][xa] > Max)  Max = InAccu[ya][xa];
            }  }
            if (Inc==Max)  OutAccu[r][c] = Inc;
}  }  }  }
